package cn.edu.scau.cmi.yangzhichao.multipleton;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import java.util.ArrayList;
import java.util.List;


public class BasketBaller {
    private static List<BasketBaller> players=new ArrayList<>();

    public String getName() {
        return name.get();
    }

    public StringProperty nameProperty() {
        return name;
    }

    public void setName(String name) {
        this.name.set(name);
    }

    private StringProperty name;
    private BasketBaller(String name){
        this.name=new SimpleStringProperty(name);
    }
    public static List<BasketBaller> getInstance(String name){
        if(players.size()<5){
            players.add(new BasketBaller(name));
        }
        return players;
    }
}
